﻿using System;
using System.Collections.Generic;
using JetBrains.Annotations;

namespace MugenInjection.Interface.Components
{
    /// <summary>
    /// The base interface for components of the manage behaviors.
    /// </summary>
    public interface IBehaviorManagerComponent : IComponent
    {
        /// <summary>
        /// Indicates that the behaviors will be copy after call method clone.
        /// </summary>
        bool CopyBehavior { get; set; }

        /// <summary>
        /// Tries get the behavior with the specified <see cref="Type"/>.
        /// </summary>
        /// <typeparam name="TType">The specified <see cref="Type"/>.</typeparam>
        /// <param name="behavior">An instance of behavior.</param>
        /// <returns><c>True</c> if the behavior found; otherwise, <c>false</c>.</returns>
        bool TryGet<TType>(out TType behavior) where TType : class;

        /// <summary>
        /// Gets the behavior with the specified <see cref="Type"/>.
        /// </summary>
        /// <typeparam name="TType">The specified <see cref="Type"/>.</typeparam>
        /// <returns>An instance of behavior.</returns>
        TType Get<TType>() where TType : class;

        /// <summary>
        /// Gets all behaviors with the specified <see cref="Type"/>.
        /// </summary>
        /// <typeparam name="TType">The specified <see cref="Type"/>.</typeparam>
        /// <returns>An instances of behavior.</returns>
        IList<TType> GetAll<TType>() where TType : class;

        /// <summary>
        /// Indicates that the specified <see cref="Type"/> of behavior exists in the collection.
        /// </summary>
        /// <typeparam name="TType">The specified behavior <see cref="Type"/>.</typeparam>
        /// <returns><c>True</c> if the specified behavior exist; otherwise, <c>false</c>.</returns>
        bool IsExist<TType>() where TType : class;

        /// <summary>
        /// Adds the specified behavior.
        /// </summary>
        void Add<TType, TTypeTo>()
            where TType : class
            where TTypeTo : TType;
            

        /// <summary>
        /// Adds the specified behavior.
        /// </summary>
        void Add<TType>(TType behavior) where TType : class;

        /// <summary>
        /// Removes the specified behavior.
        /// </summary>
        void Remove<TType>() where TType : class;
    }
}